package com.tanhua.dubbo.api.db;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.QuizQuestion;
import com.tanhua.dubbo.mapper.QuizQuestionMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class QuizQuestionApiImpl implements QuizQuestionApi{

    @Autowired
    private QuizQuestionMapper quizQuestionMapper;

    /**
     * 查询获取所有问题集合
     * @return
     */
    @Override
    public List<QuizQuestion> getAllQuestions() {
        QueryWrapper<QuizQuestion> queryWrap = new QueryWrapper<>();
        return quizQuestionMapper.selectList(queryWrap);
    }

    /**
     * 查询所有试题的总数
     * @return
     */
    @Override
    public int queryCount() {
        QueryWrapper wrapper = new QueryWrapper();
        Integer count = quizQuestionMapper.selectCount(wrapper);
        return count;
    }
}
